package controllers;

import java.sql.ResultSet;

import models.AbstractModel;
import models.CustomTable;
import models.CustomTableModel;

import system.View;

public abstract class AbstractMenuItemController extends AbstractController {
	
	protected AbstractModel abstractModel;

	public AbstractMenuItemController(View v) {
		super(v);
	}

	@Override
	public void show() {
		ResultSet rs = abstractModel.show();
		CustomTableModel model = new CustomTableModel(abstractModel.getConnection(), rs);
		CustomTable data = new CustomTable(model);
	
		model.addExceptionListener(this);
		data.addExceptionListener(this);
		    
		view.addTable(data);
	}
}
